FROM node:14.17.6-slim as production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}

WORKDIR /usr/src/app
COPY package*.json ./

RUN npm install --only=production

COPY . .
RUN npm run build

COPY ["./dist/", "./"]
EXPOSE 3000
CMD ["node", "main.js"]